package com.xps.purifierapp.date.net;


import android.util.Log;

import com.xps.purifierapp.bean.AZBean;
import com.xps.purifierapp.bean.LoginBean;
import com.xps.purifierapp.bean.NotInstalledIBean;
import com.xps.purifierapp.bean.OrderBean;
import com.xps.purifierapp.date.serviceapi.UserApi;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;


public class UserNetWorks extends RetrofitUtils {

    protected static final UserApi UserApi = RetrofitUtils.getUserApi();


    /**
     * @deprecated 登陆
     * username 用户名
     * password 密码
     */
    public static void UserLogin(String username, String password, Subscriber<LoginBean> observer) {
        UserApi.goLogin(username, password).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @deprecated 获取需要完成的任务
     * username 不需要管
     */
    public static void getNotInstalled(String username, Subscriber<NotInstalledIBean> observer) {
        UserApi.goNotInstalled(username).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @deprecated 完成的任务
     * id 订单ID
     */
    public static void getAZ(String id, String remote_fees, String install_remark, String total_price, String is_check, String install_card, String install_pic, Subscriber<AZBean> observer) {
        UserApi.goAZ(id, remote_fees, install_remark, total_price, is_check, install_card, install_pic).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @deprecated 完成的任务
     * id 订单ID
     */
    public static void getReturn(String id, String remote_fees, Subscriber<AZBean> observer) {
        UserApi.getReturn(id, remote_fees).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);

    }


    /**
     * @deprecated 已完成完成的任务
     * username 不需要管
     */
    public static void getCompleted(String username, Subscriber<NotInstalledIBean> observer) {
        UserApi.goCompleted(username).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @deprecated 修改密码
     */
    public static void getUpdatepass(String newpassword, String oldpassword, Subscriber<AZBean> observer) {
        UserApi.goupdatepassword(newpassword, oldpassword).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }


    /**
     * @deprecated 分配的订单
     */
    public static void getfpOrder(String inquiry_date, Subscriber<OrderBean> observer) {
        UserApi.gogetOrders(inquiry_date).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

}
